<?php

/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2016/11/9
 * Time: 14:34
 */

/**
 * Class MysqliService
 * 一次数据插入
 */
require_once ('./MySqliService.php');

/*$serive = new MysqliService();
$today = date('Y-m-d');
strtotime("$today -1 day");
$storeid = 5;
for ($i=1;$i<=45;$i++){
    $date = '\''.date('Y-m-d',strtotime("$today -$i day")).'\'';
    $money = '\''.rand(5000,7000).'\'';
    $addDate = '\''.date('Y-m-d H:i:s',time()).'\'';
    $val = "$storeid,$date,$money,$addDate";
    echo $val;
    $sql = "insert into 3y_storedaymoney (storeid,date,money,adddate) VALUE ($val)";
    $res = $serive->db->query($sql);
}
$serive->close();
echo 'end';*/

$serive = new MysqliService();
/*$数组 = array(
    array(71.2, 73.8, 76.5, 79.3),
    array(81.6, 85.1, 88.5, 92.1),
    array(89.3, 93.0, 96.8, 100.7),
    array(96.3, 100.2, 104.1, 108.2),
    array(102.8, 107.0, 111.3, 115.7),
    array(108.6, 113.1, 117.7, 122.4),
    array(114.0, 119.0, 124.0, 129.1),
    array(119.3, 124.6, 130.0,135.5 ),
    array(123.9, 129.6, 135.4,141.2 ),
    array(127.9, 134.0, 140.2,146.4 ),
    array(132.1, 138.7, 145.3,152.1 ),
    array(137.2, 144.6, 151.9,159.4 ),
    array(144.0, 151.8, 159.5,167.3 ),
    array(151.5, 158.7, 165.9,173.1 ),
    array(156.7, 163.3, 169.8,176.3 ),
    array(159.1, 165.4, 171.6,177.8 ),
    array(160.1, 166.3, 172.3,178.4 ),
    array(160.5, 166.6, 172.7,178.7 ),
);*/
$arr = array(
    array(69.7,72.3,75.0,77.7),
    array(80.5,83.8,87.2,90.7),
    array(88.2,91.8,95.6,99.4),
    array(95.4,99.2,103.1,107.0),
    array(101.8,106.0,110.2,114.5),
    array(107.6,112.0,116.6,121.2),
    array(112.7,117.6,122.5,127.6),
    array(117.9,123.1,128.5,133.9),
    array(122.6,128.3,134.1,139.9),
    array(127.6,133.8,140.1,146.4),
    array(133.4,140.0,146.6,153.3),
    array(139.5,145.9,152.4,158.8),
    array(144.2,150.3,156.3,162.3),
    array(147.2,152.9,158.6,164.3),
    array(148.8,154.3,159.8,165.3),
    array(149.2,154.7,160.1,165.5),
    array(149.5,154.9,160.3,165.7),
    array(149.8,155.2,160.6,165.9),
);
//$age = 1;
$sex = 2;

for ($j = 1; $j <= 17; $j++) {
    for ($i = 0; $i <= 11; $i++) {
        $shortmin = $arr[$j - 1][0] + ($arr[$j][0] - $arr[$j - 1][0]) / 12 * $i;
        $short = $arr[$j - 1][1] + ($arr[$j][1] - $arr[$j - 1][1]) / 12 * $i;
        $stand = $arr[$j - 1][2] + ($arr[$j][2] - $arr[$j - 1][2]) / 12 * $i;
        $superheight = $arr[$j - 1][3] + ($arr[$j][3] - $arr[$j - 1][3]) / 12 * $i;
        $val = "$j,$sex,$i,$shortmin,$short,$stand,$superheight";
        $sql = "insert into aigoo_standard (age,sex,month,shortmin,short,stand,superheight) VALUE ($val)";
        $res = $serive->db->query($sql);
    }
}

$serive->close();
echo 'end';



